<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新品有戏商家合作平台</title>
    <script src="__JS__/jquery.js"></script>
    <link href="__CSS__/boot.css" rel="stylesheet">
    <link href="__STATIC__/layui/css/layui.css" rel="stylesheet">
    <script src="__JS__/layer/layer.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="__STATIC__/boot/js/dropdown.js"></script>
</head>
<body>
<div style="height: 50px"></div>
<div style="width: 300px;height: 300px;margin-left: 80px">
    <form class="layui-form" action="" id="logistics">
        <input type="hidden" name="id" value="{$id}">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 100px">运单号</label>
            <div class="layui-input-block">
                <input type="text" name="oddnumber" required  lay-verify="required" placeholder="运单号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 100px">快递公司</label>
            <div class="layui-input-block">
                <input type="text" name="express" required  lay-verify="required" placeholder="请输入快递公司" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="button" onclick="add()" class="btn btn-info">立即添加</button>
                <button type="button" onclick="reset()" class="btn btn-warning">重置</button>
            </div>
        </div>
    </form>
</div>
</body>
<script>
    //添加
    function add() {
        $.ajax({
            url:"{:url('index/purchase/logistics')}",
            data:$("#logistics").serialize(),
            type:"post",
            dataType:"json",
            success:function (res) {
                if(res.success){
                    layer.msg(res.success,{icon: 1,time:2000},function () {
                        //获取窗口索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭弹出的子页面窗口
                        parent.layer.close(index);
                        window.parent.location.reload();
                    });
                }
            }
        });
    }
    //重置
    function reset() {
        $("#logistics").reset();
    }
</script>
</html>